home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 14
/
CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso
/
System
/
CDsupport
/
IDer
/
Routines
/
AppIcon.s
next >
Wrap
Text File
|
1997-02-18
|
3KB
|
174 lines
DoAppIcon: Move.W #CUSTAPPICONERR,_ErrorCode
Move.L _AppIcon(PC),A2
Cmp.L #0,A2
Beq.S .UseDefIcon
Lea Info(PC),A0
Move.L A2,A1
Bsr FindData
Tst.L D0
Bne.S .No_Info
Clr.B (A0)
.No_Info Move.L A2,A0
CALL GetDiskObject,ICON
Move.L D0,_IconObject
Bne .GotIcon
Bsr ErrorHandler
.UseDefIcon Move.W #APPICONERR,_ErrorCode
Move.L _WBMessage(PC),A0
Move.L sm_ArgList(A0),A2
Cmp.L #0,A2
Beq CloseDown
Move.L (A2),D1 ;wa_Lock
CALL CurrentDir,DOS
Move.L D0,_OldDirectory
Move.L wa_Name(A2),A0
CALL GetDiskObject,ICON
Move.L D0,_IconObject
Beq CloseDown
.GotIcon
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Move.L _OldDirectory(PC),D1
CALL CurrentDir,DOS
Clr.L _OldDirectory
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Move.L _IconObject(PC),A0
Move.L _AppIconX(PC),do_CurrentX(A0)
Move.L _AppIconY(PC),do_CurrentY(A0)
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
CALL CreateMsgPort,EXEC
Move.L D0,_AppMsgPort
Beq CloseDown
Move.L D0,A0
Moveq #0,D0
Move.B MP_SIGBIT(A0),D0
Moveq #1,D1
Lsl.L D0,D1
Move.L D1,_Signal
OPENLIBRARY WB,0
Moveq #69,D0 ;ID
Moveq #0,D1 ;UserData
Move.L _AppName(PC),A0 ;text
Move.L _AppMsgPort(PC),A1 ;msg port
Sub.L A2,A2 ;lock (not used)
Move.L _IconObject(PC),A3 ;icon
Sub.L A4,A4 ;Tags (not used)
CALL AddAppIconA,WB
Move.L D0,_AppIconActual
Beq CloseDown
Clr.W _ErrorCode
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
AppLoop: Move.L _Signal(PC),D0
BSet #SIGBREAKB_CTRL_C,D0
CALL Wait,EXEC
Btst #SIGBREAKB_CTRL_C,D0
Bne CloseDown
.MsgLoop Move.L _AppMsgPort(PC),A0
CALL GetMsg,EXEC
Tst.L D0
Beq.S AppLoop
Move.L D0,_AppMsg
Move.L D0,A0
Move.L am_NumArgs(A0),D0
Tst.L D0
Beq.S .NoArgsProvided
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Move.L am_ArgList(A0),A1
Move.L am_NumArgs(A0),D0
Move.L A1,_CurrentName
Move.W D0,_LoopCount
Beq.S .MsgLoop
Clr.L FileName
Move.W #ARGS_ICONS,_ArgMode
Bsr DoFiles
Move.L _AppMsg(PC),A1
CALL ReplyMsg,EXEC
Clr.L _AppMsg
Bra.S .MsgLoop
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
.NoArgsProvided Sub.L A0,A0 ;window to open on
Lea _esReq(PC),A1 ;easyrequest structure
Sub.L A2,A2 ;no custom IDCMP requests
Move.L #AboutText,es_TextFormat(A1) ;requestor text
Move.L #AboutGads,es_GadgetFormat(A1) ;requestor gadget
Sub.L A3,A3 ;requestor text arguments
CALL EasyRequestArgs,INTUI ;bring up the requestor.
Cmp.B #1,D0
Beq.S .UseASL
Cmp.L #2,D0
Beq CloseDown
Move.L _AppMsg(PC),A1
CALL ReplyMsg,EXEC
Clr.L _AppMsg
Bra.S .MsgLoop
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
.UseASL Move.W #ASLOPENERR,_ErrorCode
Tst.L _ASLBase
Bne.S .GotASLLib
OPENLIBRARY ASL,38
.GotASLLib Move.W #ASLREQERR,_ErrorCode
Moveq #ASL_FileRequest,D0
Sub.L A0,A0
CALL AllocAslRequest,ASL
Move.L D0,_Requestor
Beq.S CloseDown
Clr.W _ErrorCode
Move.L _Requestor(PC),A0
Lea _ASLTags(PC),A1
CALL AslRequest
Cmp.L #FALSE,D0
Beq .MsgLoop
Move.L _Requestor(PC),A0
Move.L fr_ArgList(A0),_CurrentName
Move.L fr_NumArgs(A0),D0
Move.W D0,_LoopCount
Beq .MsgLoop
Clr.L _FileName
Move.W #ARGS_ASLREQ,_ArgMode
Bsr DoFiles
Move.L _Requestor(PC),A0 ;free up requestor structure
CALL FreeAslRequest,ASL
Clr.L _Requestor
Move.L _AppMsg(PC),A1
CALL ReplyMsg,EXEC
Clr.L _AppMsg
Bra .MsgLoop